package com.baizhi.controller;


import com.baizhi.entity.Student;
import com.baizhi.service.IStudentService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhenggang
 * @since 2021-09-29
 */
@RestController
@RequestMapping("/student")
public class StudentController {
    @Autowired
    private IStudentService ss;
    @GetMapping("selectByPage/{pageNo}/{pageSize}")
    public IPage<Student> selectByPage(@PathVariable("pageNo") int pageNo, @PathVariable("pageSize") int pageSize){
        Page<Student> page=new Page<>(pageNo,pageSize);
        return ss.page(page);
    }
    @GetMapping("/selectAll")
    public List<Student> selectAll(){
        return ss.list(null);
    }
}

